<?php

Class IndexAction extends Action {

	Public function index () {
		//测试设置独立分组
		// echo C('APP_GROUP_MODE'),'<br>',C('APP_GROUP_PATH');die();
		$wish = M('wish')->select();
		$this->assign('wish', $wish)->display();
	}
	/**
	 * 异步发布处理
	 */
	Public function handle () {
		// if (!IS_AJAX) halt('页面不存在');
		if (!IS_AJAX) _404('页面不存在');
		// var_dump(IS_AJAX)
		// p(I('post.'));
		$data = array(
			'username' => I('post.username'),
			'content' => I('content'),
			'time' => time()
			);

		if ($id = M('wish')->data($data)->add()) {
			$data['id'] = $id;
			$data['content'] = replace_phiz($data['content']);
			$data['time'] = date('y-m-d H:i', $data['time']);
			$data['status'] =1;
			$this->ajaxReturn($data, 'json');
		} else {
			$this->ajaxReturn(array('status' => 0), 'json');
		}
		// replace_phiz($data['content']);


	}
}
?>